home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / ooo / f_0020 / sbasic.jar / text / sbasic / common / 03120314.xml < prev    next >
Encoding:
Extensible Markup Language  |  2003-08-01  |  7.0 KB  |  61 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>Split Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03120314"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         span.T1{
  7.                 font-weight:bold;}
  8.         </style></head><body>
  9.   
  10.   
  11.   <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="split" xmlns:help="http://openoffice.org/2000/help">
  12.   <p class="Head1"><help:paragraphinfo state="U" number="1"/><help:key-word value="Split; function" tag="kw68668_1"/><help:link Id="68668">Split Function [Runtime]</help:link></p>
  13.   <p class="Paragraph"><help:paragraphinfo state="U" number="2"/>Returns an array of substrings from a string expression.</p>
  14.   <help:paragraphinfo state="E"/></help:to-be-embedded>
  15.   <p class="Head2"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>Syntax:</p>
  16.   <p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>Split (Text As String, delimiter, number)</p>
  17.   <p class="Head2"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>Return value:</p>
  18.   <p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>String</p>
  19.   <p class="Head2"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/>Parameters:</p>
  20.   <p class="Paragraph"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Text:</span> Any string expression.</p>
  21.   <p class="Paragraph"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">delimiter (optional):</span> A string character that is used to delimit the Text. The default is the space character.</p>
  22.   <p class="Paragraph"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">number (optional):</span> The number of substrings that you want to return.</p>
  23.   <p class="Head2"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>Example:</p>
  24.   <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="splitjoinex" xmlns:help="http://openoffice.org/2000/help">
  25.   <p class="PropText"><help:paragraphinfo state="U" number="11"/>Dim a(3)</p>
  26.   <p class="PropText"><help:paragraphinfo state="U" number="13"/>Sub main()</p>
  27.   <p class="PropText"><help:paragraphinfo state="U" number="14"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>a(0) = "ABCDE"</p>
  28.   <p class="PropText"><help:paragraphinfo state="U" number="15"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>a(1) = 42</p>
  29.   <p class="PropText"><help:paragraphinfo state="U" number="16"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>a(2) = "MN"</p>
  30.   <p class="PropText"><help:paragraphinfo state="U" number="17"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>a(3) = "X <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Y Z"</p>
  31.   <p class="PropText"><help:paragraphinfo state="U" number="18"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>JStr = Join1()</p>
  32.   <p class="PropText"><help:paragraphinfo state="U" number="19"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Call Show(JStr, Split1(JStr))</p>
  33.   <p class="PropText"><help:paragraphinfo state="U" number="20"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>JStr = Join2()</p>
  34.   <p class="PropText"><help:paragraphinfo state="U" number="21"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Call Show(JStr, Split1(JStr))</p>
  35.   <p class="PropText"><help:paragraphinfo state="U" number="22"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>JStr = Join3()</p>
  36.   <p class="PropText"><help:paragraphinfo state="U" number="23"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Call Show(JStr, Split1(JStr))</p>
  37.   <p class="PropText"><help:paragraphinfo state="U" number="24"/>End Sub</p>
  38.   <p class="PropText"><help:paragraphinfo state="U" number="25"/>Function Join1()</p>
  39.   <p class="PropText"><help:paragraphinfo state="U" number="26"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Join1 = Join(a(), "abc")</p>
  40.   <p class="PropText"><help:paragraphinfo state="U" number="45"/>End Function</p>
  41.   <p class="PropText"><help:paragraphinfo state="U" number="27"/>Function Join2()</p>
  42.   <p class="PropText"><help:paragraphinfo state="U" number="28"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Join2 = Join(a(), ",")</p>
  43.   <p class="PropText"><help:paragraphinfo state="U" number="29"/>End Function</p>
  44.   <p class="PropText"><help:paragraphinfo state="U" number="30"/>Function Join3()</p>
  45.   <p class="PropText"><help:paragraphinfo state="U" number="31"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Join3 = Join(a())</p>
  46.   <p class="PropText"><help:paragraphinfo state="U" number="32"/>End Function</p>
  47.   <p class="PropText"><help:paragraphinfo state="U" number="33"/>Function Split1(aStr)</p>
  48.   <p class="PropText"><help:paragraphinfo state="U" number="34"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Split1 = Split(aStr, "D")</p>
  49.   <p class="PropText"><help:paragraphinfo state="U" number="35"/>End Function</p>
  50.   <p class="PropText"><help:paragraphinfo state="U" number="36"/>Sub Show(JoinStr, TheArray)</p>
  51.   <p class="PropText"><help:paragraphinfo state="U" number="37"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>l = LBound(TheArray)</p>
  52.   <p class="PropText"><help:paragraphinfo state="U" number="38"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>u = UBound(TheArray)</p>
  53.   <p class="PropText"><help:paragraphinfo state="U" number="39"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>total$ = "=============================" + Chr$(13) + JoinStr + Chr$(13) + Chr$(13)</p>
  54.   <p class="PropText"><help:paragraphinfo state="U" number="40"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>For i = l To u</p>
  55.   <p class="PropText"><help:paragraphinfo state="U" number="41"/> <text:s text:c="7" xmlns:text="http://openoffice.org/2000/text"/>total$ = total$ + TheArray(i) + Str(Len(TheArray(i))) + Chr$(13)</p>
  56.   <p class="PropText"><help:paragraphinfo state="U" number="42"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>Next i</p>
  57.   <p class="PropText"><help:paragraphinfo state="U" number="43"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>MsgBox total$</p>
  58.   <help:paragraphinfo state="E"/> <text:s text:c="3" xmlns:text="http://openoffice.org/2000/text"/>
  59.   <p class="PropText"><help:paragraphinfo state="U" number="44"/>End Sub</p>
  60.   <help:paragraphinfo state="E"/></help:to-be-embedded>
  61.  </body></html>